<?php

//phpinfo();

/*echo "This spans
multiple lines. The newlines will be
output as well
";

@print <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!

END;

$txt1 = "hello, world 1, world 2";
$txt2 = "i'm sam";
echo strlen($txt1) . ":" . $txt1 . "\n" . strlen($txt2) . ":" . $txt2 . "\n";
echo strpos($txt1, "world", 8) . "\n";

$d=date("d");
if (($d % 3) == 0)
{
    echo "$d: 3k";
}
elseif (($d % 3) == 1)
{
    echo "$d: 3k+1";
}
else
{
    echo "$d: 3k+2";
}

echo "\nEscaping characters is done \"Like this\".\n";
echo $d,$d,"\n";

$d ? print "true" : print "false";
echo  "\n".($d ? "true" : "false");
 */

/*
$multi_array = array(
    "1" => array(
        "1.1",
        "1.2",
        ),
    "2" => array(
        "2.1",
        "2.2",
        )
    );
var_dump($multi_array);

for ($i=0; ($i < 5); $i++)
{
    echo "loop $i\n";
}

$a = array("one", "two", "three", "four");
$i = 0;
foreach ($a as $element)
{
    echo "\$a[$i]: $element\n";
    $i++;
}
 */

/*
function show_name(&$name)
{
    $name = "sam";
}

$name= 'yangxin';
echo "name:$name\n";
show_name($name);
echo "name:$name\n";

function sum($x, $y)
{
    return $x+$y;
}

echo sum(6,7);
 */

/*
class A
{
    public $var1;
    public $var2;

    public static function __set_state($an_array)
    {
        $obj = new A;
        $obj->var1 = $an_array['var1'];
        $obj->var2 = $an_array['var2'];
        return $obj;
    }
}

$a = new A;
$a->var1 = 5;
$a->var2 = 'foo';

$res = var_export($a, true);
echo "$res\n";

eval('$b = ' . var_export($a, true) . ';'); // $b = A::__set_state(array(
                                            //    'var1' => 5,
                                            //    'var2' => 'foo',
                                            // ));
var_dump($b);
 */

/*date_default_timezone_set('Asia/Shanghai');
echo date('O Y-m-d G:i:s, l') . "\n";
echo "tomorrow is: " . date('O Y-m-d G:i:s, l', mktime(0,0,0,date('m'), date('d')+1, date('Y'))) . "\n";*/

/*$filename="test.php";
echo $filename . ": " . filesize($filename) . " bytes<br />";*/

$foo = include "inc2.php";
echo $foo;
echo date('O Y-m-d G:i:s, l') . "\n";

?>
